#include "dockWidget.h"

DockWidget::DockWidget(QWidget * parent, const QString & title) : QWidget(parent), m_parent(parent) 
{
    this->setLayout(new QVBoxLayout(this));
    QWidget * head = new QWidget(this);
    head->setLayout(new QHBoxLayout(head));
    QPushButton * closeBtn = new QPushButton("close", head);
    head->layout()->addWidget(closeBtn);
    head->layout()->addWidget(new QLabel(title, head));
    
    connect(closeBtn, &QPushButton::clicked, [=] () {this->hide();});

    this->hide();
}

void DockWidget::mouseDoubleClickEvent(QMouseEvent *event)
{

    if(m_isFullScreen == false)
    {
        setParent(nullptr);
        setWindowFlag(Qt::Window);
        showFullScreen();
        m_isFullScreen = true;
    }
    else
    {
        setParent(m_parent);
        setWindowFlag(Qt::SubWindow);
        showNormal();
        m_isFullScreen = false;
    }

}



